﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Entities
{
    [Serializable]
    public class Train
    {
        private string trainID;
        private int routeID;
        private float maxSpeed;
        private float minSpeed;
        private string startTime;
        private bool status;
        public Train()
        { }
        public Train(string trainID, int routeID, float maxSpeed, float minSpeed, string startTime, bool status)
        {
            this.trainID = trainID;
            this.routeID = routeID;
            this.maxSpeed = maxSpeed;
            this.minSpeed = minSpeed;
            this.startTime = startTime;
            this.status = status;
        }
        public string TrainID
        {
            get { return this.trainID; }
            set
            {
                if (value == null)
                    throw new Exception("trainID not allow nullvalue.");
                this.trainID = value;
            }
        }
        public int RouteID
        {
            get { return this.routeID; }
            set { this.routeID = value; }
        }
        public float MaxSpeed
        {
            get { return this.maxSpeed; }
            set { this.maxSpeed = value; }
        }
        public float MinSpeed
        {
            get { return this.minSpeed; }
            set { this.minSpeed = value; }
        }
        public string StartTime
        {
            get { return this.startTime; }
            set { this.startTime = value; }
        }
        public bool Status
        {
            get { return this.status; }
            set { this.status = value; }
        }
        public override string ToString()
        {
            return this.trainID + "; " + this.routeID + "; " + this.maxSpeed + "; " + this.minSpeed + "; " + this.startTime + "; " + this.status + "; ";
        }
        public override bool Equals(Object obj)
        {
            Train me = (Train)obj;
            bool ret = this.TrainID.Equals(me.TrainID);
            return ret;
        }
        public override int GetHashCode()
        {
            return this.TrainID.GetHashCode();
        }

    }
}